﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Controls_Reports_AccountOverview : System.Web.UI.UserControl
{
	public BO.Account Account { get; set; }

	protected void Page_Load(object sender, EventArgs e)
	{
		if (!IsPostBack)
			LoadData();
	}

	public override void DataBind()
	{
		base.DataBind();

		if (IsPostBack)
		{
			LoadData();
		}
	}

	private void LoadData()
	{
		hlName.Text = Account.Name;
		hlName.NavigateUrl = AppParams.URLs.AccountPageUrl(Account.ID);
		lblFbFans.Text = Account.FbPageFanNum.ToString();
		lblTwFollowers.Text = Account.TwFollowersNum.ToString();
		amLine.ExternalDataFileUrl = "/Service/websiteservice.asmx/AccountTimeLine?ID=" + Account.ID.ToString();

		lblFbAvgComments.Text = Account.OverView.FbAvgComments.ToString();
		lblFbComments.Text = Account.OverView.FbCommentCount.ToString();

		lblPostCount.Text = Account.OverView.TotalPostCount.ToString();
		lblUsrCount.Text = Account.OverView.TotalFanCount.ToString();
		lblTwAvgComments.Text = Account.OverView.TwAvgReplies.ToString();
		lblTwReplys.Text = Account.OverView.TwReplyCount.ToString();

		lblRequirAction.Visible = Account.ID % 3 == 0;
	}
}